/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * Description:
 * Author: huawei
 * Create: 2023-07-25
 */
#ifndef SVM_GFP_H
#define SVM_GFP_H

#include <linux/types.h>
#include <linux/mm.h>

struct devmm_phy_addr_attr {
    u32 side;
    u32 devid;
    u32 vfid;
    u32 module_id;

    u32 pg_type;
    u32 mem_type;
    bool is_continuous;
};

int devmm_alloc_pages(struct devmm_phy_addr_attr *attr, struct page **pages, u64 pg_num);
void devmm_free_pages(struct devmm_phy_addr_attr *attr, struct page **pages, u64 pg_num);

void devmm_put_normal_page(struct page *pg);
void devmm_put_huge_page(struct page *hpage);

#endif
